package com.china_goldcard.igas.ui.pages;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.ImageView;

import com.china_goldcard.banner.XBanner;
import com.china_goldcard.igas.R;
import com.china_goldcard.igas.ui.core.BaseActivity;
import com.squareup.picasso.Picasso;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by jk on 16/10/12.
 */

public class WelcomePage extends BaseActivity {

    @BindView(R.id.bannerV)
    XBanner banner;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        ButterKnife.bind(this);
        final List<String> list = new ArrayList<>();
        list.add("http://t1.niutuku.com/960/10/10-202370.jpg");
        list.add("http://h.hiphotos.baidu.com/zhidao/pic/item/6d81800a19d8bc3ed69473cb848ba61ea8d34516.jpg");
        banner.setData(list);
        banner.setmAdapter(new XBanner.XBannerAdapter() {
            @Override
            public void loadBanner(XBanner banner, View view, int position) {
                Picasso.with(WelcomePage.this).load(list.get(position)).into((ImageView) view);
            }
        });
        banner.setOnItemClickListener(new XBanner.OnItemClickListener() {
            @Override
            public void onItemClick(XBanner banner, int position) {
               toPage(HomePage.class,null);
            }
        });
    }

    @Override
    protected boolean supportSlideClose() {
        return false;
    }

    @Override
    protected Integer layoutResource() {
        return R.layout.welcome;
    }
}
